package com.nidu.demo.common.validation;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

@Documented
@Constraint(validatedBy = InEnumValidator.class) // 绑定校验器
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface InEnum {

    /**
     * 指定枚举类，必须实现 IntArrayValuable 接口
     */
    Class<? extends IntArrayValuable> value();

    /**
     * 校验失败时的错误信息
     */
    String message() default "参数值不在合法枚举范围内";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

}
